<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">

                <h:form>

                    <p:panel header="Add Investigations for Investigation" >

                        <p:panelGrid columns="3"  >

                            <h:outputLabel value="Select Parent Ix" ></h:outputLabel>

                            <p:autoComplete widgetVar="aIx" id="cmbPi" forceSelection="true" value="#{itemForItemController.parentItem}" completeMethod="#{investigationController.completeItem}" var="ix" itemLabel="#{ix.name}" itemValue="#{ix}" size="30"  style="width: 400px;">
                                <p:ajax event="itemSelect" process="cmbPi" update="lstIfi" />
                            </p:autoComplete>


                            <h:commandButton value="Back" action="/lab/investigation" ></h:commandButton>


                            <h:outputLabel value="Select Child Ix" ></h:outputLabel>
                            
                            <p:autoComplete widgetVar="aIxC" id="cmbCi" forceSelection="true" value="#{itemForItemController.childItem}" completeMethod="#{investigationController.completeItem}" var="ixc" itemLabel="#{ixc.name}" itemValue="#{ixc}" size="30"  style="width: 400px;">
                                <p:ajax event="itemSelect" process="cmbPi" update="lstIfi" />
                            </p:autoComplete>

                       
                            
                            <h:commandButton value="Add" action="#{itemForItemController.addItem()}" ></h:commandButton>

                            <h:outputLabel value="Added Items" ></h:outputLabel>
                            <p:selectOneListbox value="#{itemForItemController.current}" id="lstIfi" styleClass="mediuminput" >
                                <f:selectItems value="#{itemForItemController.items}" var="ifi" itemLabel="#{ifi.childItem.name}" itemValue="#{ifi}" />
                            </p:selectOneListbox>
                            
                            <h:commandButton value="Remove" action="#{itemForItemController.removeItem()}" ></h:commandButton>

                        </p:panelGrid>


                    </p:panel>


                </h:form>



            </ui:define>



        </ui:composition>

    </h:body>
</html>
